package svc

import (
	"2211a_mayi/api/internal/config"
	"2211a_mayi/api/internal/middleware"
	"2211a_mayi/service/mayi"
	"2211a_mayi/service/mayiclient"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
)

type ServiceContext struct {
	Config    config.Config
	AuthToken rest.Middleware
	Service   mayi.MayiClient
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:    c,
		AuthToken: middleware.NewAuthTokenMiddleware().Handle,
		Service:   mayiclient.NewMayi(zrpc.MustNewClient(c.Service)),
	}
}
